/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author tebet1
 */
@Entity
@Table(name = "pos_transaction_sale_detail")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PosTransactionSaleDetail.findAll", query = "SELECT p FROM PosTransactionSaleDetail p"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySync", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.sync = :sync"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySaleDetailId", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.saleDetailId = :saleDetailId"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySaleDetailQuantity", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.saleDetailQuantity = :saleDetailQuantity"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySaleDetailPrice", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.saleDetailPrice = :saleDetailPrice"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySaleDetailDiscountPercent", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.saleDetailDiscountPercent = :saleDetailDiscountPercent"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySaleDetailDiscountNominal", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.saleDetailDiscountNominal = :saleDetailDiscountNominal"),
    @NamedQuery(name = "PosTransactionSaleDetail.findBySaleDetailTotal", query = "SELECT p FROM PosTransactionSaleDetail p WHERE p.saleDetailTotal = :saleDetailTotal")})
public class PosTransactionSaleDetail implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "sale_detail_id")
    private Integer saleDetailId;
    @Column(name = "sale_detail_quantity")
    private Integer saleDetailQuantity;
    @Column(name = "sale_detail_size")
    private String saleDetailSize;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "sale_detail_price")
    private BigDecimal saleDetailPrice;
    @Column(name = "sale_detail_discount_percent")
    private BigDecimal saleDetailDiscountPercent;
    @Column(name = "sale_detail_discount_nominal")
    private BigDecimal saleDetailDiscountNominal;
    @Column(name = "sale_detail_total")
    private BigDecimal saleDetailTotal;
    @JoinColumn(name = "sale_detail_sale_id", referencedColumnName = "sale_id")
    @ManyToOne(optional = false)
    private PosTransactionSale saleDetailSaleId;
    @JoinColumn(name = "sale_detail_item_id", referencedColumnName = "item_id")
    @ManyToOne(optional = false)
    private PosMasterItem saleDetailItemId;
    @JoinColumn(name = "sale_detail_size_id", referencedColumnName = "size_id")
    @ManyToOne(optional = false)
    private PosMasterSize saleDetailSizeId;

    public PosTransactionSaleDetail() {
    }

    public PosTransactionSaleDetail(Integer saleDetailId) {
        this.saleDetailId = saleDetailId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public String getSaleDetailSize() {
        return saleDetailSize;
    }

    public void setSaleDetailSize(String saleDetailSize) {
        this.saleDetailSize = saleDetailSize;
    }

    public PosMasterSize getSaleDetailSizeId() {
        return saleDetailSizeId;
    }

    public void setSaleDetailSizeId(PosMasterSize saleDetailSizeId) {
        this.saleDetailSizeId = saleDetailSizeId;
    }

    public Integer getSaleDetailId() {
        return saleDetailId;
    }

    public void setSaleDetailId(Integer saleDetailId) {
        this.saleDetailId = saleDetailId;
    }

    public PosMasterItem getSaleDetailItemId() {
        return saleDetailItemId;
    }

    public void setSaleDetailItemId(PosMasterItem saleDetailItemId) {
        this.saleDetailItemId = saleDetailItemId;
    }

    public PosTransactionSale getSaleDetailSaleId() {
        return saleDetailSaleId;
    }

    public void setSaleDetailSaleId(PosTransactionSale saleDetailSaleId) {
        this.saleDetailSaleId = saleDetailSaleId;
    }

    public Integer getSaleDetailQuantity() {
        return saleDetailQuantity;
    }

    public void setSaleDetailQuantity(Integer saleDetailQuantity) {
        this.saleDetailQuantity = saleDetailQuantity;
    }

    public BigDecimal getSaleDetailPrice() {
        return saleDetailPrice;
    }

    public void setSaleDetailPrice(BigDecimal saleDetailPrice) {
        this.saleDetailPrice = saleDetailPrice;
    }

    public BigDecimal getSaleDetailDiscountPercent() {
        return saleDetailDiscountPercent;
    }

    public void setSaleDetailDiscountPercent(BigDecimal saleDetailDiscountPercent) {
        this.saleDetailDiscountPercent = saleDetailDiscountPercent;
    }

    public BigDecimal getSaleDetailDiscountNominal() {
        return saleDetailDiscountNominal;
    }

    public void setSaleDetailDiscountNominal(BigDecimal saleDetailDiscountNominal) {
        this.saleDetailDiscountNominal = saleDetailDiscountNominal;
    }

    public BigDecimal getSaleDetailTotal() {
        return saleDetailTotal;
    }

    public void setSaleDetailTotal(BigDecimal saleDetailTotal) {
        this.saleDetailTotal = saleDetailTotal;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (saleDetailId != null ? saleDetailId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionSaleDetail)) {
            return false;
        }
        PosTransactionSaleDetail other = (PosTransactionSaleDetail) object;
        if ((this.saleDetailId == null && other.saleDetailId != null) || (this.saleDetailId != null && !this.saleDetailId.equals(other.saleDetailId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.sandals.pos.entities.PosTransactionSaleDetail[ saleDetailId=" + saleDetailId + " ]";
    }
}
